//
//  slideRoot.m
//  EFExtend
//
//  Created by mac on 15/3/25.
//  Copyright (c) 2015年 Eric. All rights reserved.
//

#import "slideRoot.h"


@interface slideRoot ()

@end

@implementation slideRoot

- (void)dealloc
{
   
    HM_SUPER_DEALLOC();
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    
    [self.customNavLeftBtn setImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];
    [self.customNavLeftBtn setFrame:CGRectMakeBound(32, 32)];
    
    [self.customNavRightBtn setImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];
    [self.customNavRightBtn setFrame:CGRectMakeBound(32, 32)];
    
    [self setTitle:@"slideRoot"];
    
    NSDate *date1 = [NSDate date:[NSDate date] forDay:4];
    NSDate *date2 = [NSDate date:[NSDate date] forDay:5];
    NSDate *date3 = [NSDate date:[NSDate date] forDay:6];
    NSDate *date4 = [NSDate date:[NSDate date] forDay:7];
    NSDate *date5 = [NSDate date:[NSDate date] forDay:8];
    NSDate *date6 = [NSDate date];//今天星期六
    NSDate *date7 = [NSDate date:[NSDate date] forDay:10];
    
    INFO(@(date1.weekday),@(date2.weekday),@(date3.weekday),@(date4.weekday),@(date5.weekday),@(date6.weekday),@(date7.weekday));
//    [self.tableView reloadData];
//    
//    self.view.backgroundColor = [UIColor grayColor];
    HMUICalendarView *calendarv = [[HMUICalendarView alloc]init];
    calendarv.model = calendarBuildModel_WEEK;
    calendarv.selectDate = [NSDate date];
    calendarv.startStyle = calendarStartStyle_Monday;
    calendarv.itemSize = CGSizeMake(40, 40);
//    calendarv.weekSpace  =-40;
    [calendarv EFOwner:self.view];
//    calendarv.delegate = self;
    [calendarv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.view.mas_top).offset(0);
        make.left.mas_equalTo(self.view.mas_left).offset(0);
        make.height.mas_equalTo(280);
        make.right.mas_equalTo(self.view.mas_right).offset(0);
    }];
//    [calendarv CalendarOfDay:[NSDate date]];
    
//    NSArray *objectsToShare = @[@"http://www.baidu.com"];
    
//    UIActivityViewController *controller = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];
    
//    NSArray *excludedActivities = @[UIActivityTypePostToTwitter, UIActivityTypePostToFacebook,
//                                    UIActivityTypePostToWeibo,
//                                    UIActivityTypeMessage, UIActivityTypeMail,
//                                    UIActivityTypePrint, UIActivityTypeCopyToPasteboard,
//                                    UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll,
//                                    UIActivityTypeAddToReadingList, UIActivityTypePostToFlickr,
//                                    UIActivityTypePostToVimeo, UIActivityTypePostToTencentWeibo];
//    controller.excludedActivityTypes = excludedActivities;
    
//    [self presentViewController:controller animated:YES completion:nil];
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

ON_Button(signal){
    UIButten *btn = signal.source;
    if ([signal is:[UIButten TOUCH_UP_INSIDE]]) {
        if ([btn is:@"leftBtn"]) {//customNavLeftBtn
//            [self backAndRemoveWithAnimate:YES];
            signal.forward = YES;
        }else if ([btn is:@"rightBtn"]){//customNavRightBtn
//            [self pushToPath:URLFOR_controller(@"slidePage") animated:YES];
            [self slideShowSide:UISlideStateRight];
        }
    }
}

ON_WebAPI(dlg){
    if (dlg.sending) {
        
        
    }else if (dlg.succeed){
//        NSDictionary *dic = [dlg.output objectForKey:[HMWebAPI params]];
        
        
    }else if (dlg.failed){
        if (dlg.timeout) {
            [self showFailureTip:@"操作失败" detail:@"链接超时" timeOut:3.f];
            return;
        }
        
        [self showFailureTip:@"网络链接失败" detail:@"数据不存在或网络错误" timeOut:3.f];
    }else if (dlg.cancelled){
        
    }
//#if (__ON__ == __HM_DEVELOPMENT__)
//    CC( [self.class description],dlg.responseData?dlg.responseData:dlg.errorDesc);
//#endif	// #if (__ON__ == __BEE_DEVELOPMENT__)
}
@end
